package logic;

import environment.Cell;
import environment.Environment;
import es.deusto.ingenieria.is.search.Node;
import es.deusto.ingenieria.is.search.heuristic.EvaluationFunction;

public class ManhattanDistance extends EvaluationFunction {

	public double calculateG(Node node) {
		return 0;
	}

	public double calculateH(Node node) {
		Environment environment = (Environment)node.getState().getInformation();
		Cell indy = environment.getIndy().getLocation();
		Cell goal = environment.getChest();
		
		return - Math.abs(goal.x - indy.x) + Math.abs(goal.y - indy.y);
	}
}
